import type { AddressItem, AddressParams } from '@/types/address'
import { my_request } from '@/utils/http'
// 新增地址
export const updateAddressAPI = (data: AddressParams) => {
  return my_request<AddressParams>({
    method: 'POST',
    url: '/member/address',
    data,
  })
}
// 查询地址
export const getMemberAddressAPI = () => {
  return my_request<AddressItem[]>({
    method: 'GET',
    url: '/member/address',
  })
}
// 根据id获取地址
export const getAddressByIdAPI = (id: string) => {
  return my_request<AddressItem>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
// 修改地址
export const updateAddressByIdAPI = (id: string, data: AddressParams) => {
  return my_request<AddressItem>({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}
// 删除地址
export const deleteAddressAPI = (id: string) => {
  return my_request({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}
